// Use first tag cloud cell type constructor.
FarPoint.Web.Spread.TagCloudCellType tagCell = new FarPoint.Web.Spread.TagCloudCellType();
tagCell.DataSource = GetData();//refer to the data source part.
tagCell.DataTextField = "Name";
tagCell.DataWeightField = "Weight";
tagCell.DataTitleField = "University";
tagCell.DataHrefField = "Favorite site";
tagCell.DataTextFormatString = "UserName:{0}";
tagCell.DataTitleFormatString = "Graduate from:[{0}]";
tagCell.DataHrefFormatString = "http://{0}";
tagCell.DataDisplayTextField = "University";
tagCell.DataItemDataField = "Weight";
FpSpread1.ActiveSheetView.Cells[0, 0].CellType = tagCell;
// Use second tag cloud cell type constructor.
FarPoint.Web.Spread.TagCloudCellType tagCell1 = new FarPoint.Web.Spread.TagCloudCellType(new string[] { "SEARCH", "ASP.NET",
"JAVASCRIPT" }, new string[] { "20", "50", "30" });
FpSpread1.ActiveSheetView.Cells[1, 0].CellType = tagCell1;
// Use third tag cloud cell type constructor.
FarPoint.Web.Spread.TagCloudCellType tagCell2 = new FarPoint.Web.Spread.TagCloudCellType(new string[] { "SEARCH", "ASP.NET",
"JAVASCRIPT" }, new string[] { "20", "50", "30" }, new string[] { "http://www.google.com", "http://gcdn.grapecity.com/cs/tags/ASP.NET/default.aspx",
"http://gcdn.grapecity.com/cs/tags/JavaScript/default.aspx" });
FpSpread1.ActiveSheetView.Cells[2, 0].CellType = tagCell2;
}
private DataTable GetData()
{
DataTable table = new DataTable("Demo");
table.Columns.Add("ID", typeof(int));
table.Columns.Add("Name", typeof(string));
table.Columns.Add("University", typeof(string));
table.Columns.Add("Favorite site", typeof(string));
table.Columns.Add("Weight", typeof(int));
table.Rows.Add(new object[] { 1, "Spread User", "FarPoint", "www.clubfarpoint.com", 20 });
table.Rows.Add(new object[] { 2, "Google User", "Google", "www.google.com", 3 });
table.Rows.Add(new object[] { 3, "Microsoft Developer", "Microsoft", "www.microsoft.com", 1 });
table.Rows.Add(new object[] { 4, "Code Project User", "CodeProject", "www.codeproject.com", 10 });
return table;
}